import random
import time
from kafka import KafkaProducer, KafkaConsumer

bootstart="127.0.0.1:9092"
producer=KafkaProducer(bootstrap_servers=bootstart)
topicname="use"
while(True):
    userid=random.randint(1,100)
    itemid=random.randint(1,10000)
    behavior=random.choice(['pv','buy','like','fav'])
    t=int(time.time())
    text=str(userid)+","+str(itemid)+","+str(behavior)+","+str(t)
    producer.send(topicname,value=text)
    # print(text)
    time.sleep(1)


